package com.aqarat.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * The persistent class for the expenses database table.
 * 
 */
@Entity
@Table(name = "expenses")
public class Expens extends com.core.entity.BaseEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name = "recid", unique = true, nullable = false)
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long recid;

	private Date date;

	private String description;

	private double money;

	@Column(name = "building_id")
	private Long buildingId;

	@ManyToOne
	@JoinColumn(name = "building_id", insertable = false, updatable = false)
	private Building building;

	// -----------------------------------/
	@Transient
	private Date dateFrom;
	@Transient
	private Date dateTo;

	public Expens() {
	}

	public Expens(Long recid, Long buildingId, String buildingName, Date date, String description, double money) {
		super();
		this.recid = recid;
		this.buildingId = buildingId;

		this.building = new Building(buildingId, buildingName);

		this.date = date;
		this.description = description;
		this.money = money;
	}

	// ------------------------------------/
	public Long getRecid() {
		return recid;
	}

	public void setRecid(Long recid) {
		this.recid = recid;
	}

	public Date getDate() {
		return this.date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public double getMoney() {
		return this.money;
	}

	public void setMoney(double money) {
		this.money = money;
	}

	public Building getBuilding() {
		return this.building;
	}

	public void setBuilding(Building building) {
		this.building = building;
	}

	public void setBuildingId(Long buildingId) {
		this.buildingId = buildingId;
	}

	public Long getBuildingId() {
		return buildingId;
	}

	public final Date getDateFrom() {
		return dateFrom;
	}

	public final void setDateFrom(Date dateFrom) {
		this.dateFrom = dateFrom;
	}

	public final Date getDateTo() {
		return dateTo;
	}

	public final void setDateTo(Date dateTo) {
		this.dateTo = dateTo;
	}

	@Override
	public String toString() {
		return "Expens [recid=" + recid + ", date=" + date + ", description=" + description + ", money=" + money + ", buildingId=" + buildingId + ", building=" + building + ", dateFrom=" + dateFrom + ", dateTo=" + dateTo + "]";
	}

}